package com.zking;

import java.util.stream.IntStream;

public class MinDemo {
    public static void main(String[] args) {

        //传统的命令式编程
        method();
        //流编程
        method2();
        //如果数据量大单线程非常麻烦，而并行流不需要关注这些

    }
    //传统的命令式变成
    public static void method(){
        int[] mums={33,55,90,-666,90};

        int min=Integer.MAX_VALUE;
        for (int mum : mums) {
            if(mum<min){
                min=mum;
            }
        }
        System.out.println(min);
    }
    //jdk8
    public static void method2(){
        int[] mums={33,55,90,-666,90};
        int min2= IntStream.of(mums).min().getAsInt();
        System.out.println(min2);
    }
}
